<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=8;" />
	<title>
		<?php  echo $title_for_layout; ?>
	</title>
	<meta name="title" content="<?php echo $meta_title;?>" />
	<meta name="keywords" content="<?php  echo $meta_keywords;?>"/>
	<meta name="description" content="<?php  echo $meta_description;?>"/>
	<?php
		echo $this->Html->css('home');
		echo $this->Html->css('menu');
        echo $this->Html->css('search');
		echo $this->Html->css('tango_skin');
        echo $this->Html->css('jquery.jgrowl');
        echo $this->Html->css('jquery-ui-1.9.0.custom.min');
        echo $this->Html->script('jquery-1.8.2.min');
        echo $this->Html->script('jquery-ui-1.9.0.custom.min');
        echo $this->Html->script('jquery.jgrowl');
        echo $this->Html->script('home');
        echo $this->Html->script('login');
        echo $this->Html->script('register');
        echo $this->Html->script('jsor-jcarousel-7bb2e0a/lib/jquery.jcarousel.min.js');
	?>
    <!--[if IE 6]>
    <?php //echo $this->Html->script('DD_belatedPNG_0.0.8a-min'); ?>
    <script type="text/javascript">//DD_belatedPNG.fix('.tips_menu,.tips_top,.tips_content,.tips_btm,.tips_HomeActive,.tips_shareActive,.tips_tipsActive,.tips_userActive,.tips_ascottsActive,.tips_inviteActive');</script>
    <![endif]-->
    <!--[if lt IE 7]>
         <script type="text/javascript" src="/js/unitpngfix.js"></script>
    <![endif]-->

    <script type="text/javascript">
        var webroot = "<?=@$this->webroot; ?>";
        var APP_URL = "<?=@APP_URL?>";
        var server = "<?='http://' . env('SERVER_NAME')?>";
        var here = "<?=@$this->here;?>";
        var display_mode = "<?=@display_mode?>";
		var baseURL = "<?= FULL_BASE_URL . $this->base . "/" ?>";
		var base = "<?= $this->base; ?>";
    </script>

    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', '<?=GA_ID?>']);
        _gaq.push(['_trackPageview']);

        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>
    <script type="text/javascript">
        webroot = <?=$this->webroot?>;
        $.jGrowl.defaults.pool = 3;
    </script>
    <?
        if (isset($bodyAttr)) {
            $bodyAttr = " $bodyAttr";
        } else {
            $bodyAttr = null;
        }
    ?>

<!--[if lte IE 6]>
<? echo $this->Html->script('ie6/warning.js');  ?>
<script>window.onload=function(){IE6WarningPopup("./js/ie6/");IE6WarningBar();}</script>
<![endif]-->

    <?php if ($this->Session->check('Message.flash')) { ?>
        <script type="text/javascript">
            $(document).ready(function(){
                $.jGrowl($('#flashMessage').text(), { sticky: true });
            });
        </script>
    <?php } ?>
</head>

<body>
	<div id="dim_block" style="background-color: white;
				position: absolute;
				z-index: 999;
				opacity: 0.6;
				visibility: hidden;"></div>
	<div style='display:none'><?php echo $this->Session->flash(); ?></div>
	<div id="jGrowl" class="bottom-right jGrowl"><div class="jGrowl-notification"></div></div>
	<div>
		<!-- Header starts -->
		<div id="header">
			<div id="logo" style="z-index:10">
				<?php echo $html->image('logo.png', array('url'=>'/')); ?>
				<p style="font:Hero;font-size:60;margin:0px;">

				</p>
			</div>

			<div class="search-area">
				<?
					echo $this->Form->create('Product', array('action' => 'search', 'class' => 'form-wrapper cf'));
					echo $this->Form->input('keyword', array(
						'label' => false,
						'div' => false,
						'placeholder' => 'Please enter your search query...',
						'onkeyup' => '',
						'autofocus' => 'autofocus'
					));
				?>
					<button type="submit">Search</button>
				</form>
			</div>
		</div>
		<!-- Header ends -->

		<div></div>

        <!-- Toolbar starts -->
        <div id='cssmenu' style="padding-top:122px">
            <ul>
				<li class="<?php if ($this->name=='Products' && $this->action=='homepage') echo 'active';?>"><?=$html->link('<span>Home</span>', '/', array('escape' => false)) ?></li>
				<li class="has-sub <?php if ($this->name=='Products' && $this->action!='homepage') echo 'active';?>">
                    <a href="javascript:void(0)">Products</a>
					<ul style="z-index:100">
					   <li><?=$html->link('<span>Advance Search</span>', '/products/category', array('escape' => false)) ?></li>
					   <li><?=$html->link('<span>Recommendations</span>', '/products/recommendation', array('escape' => false))?></li>
					   <li><?=$html->link('<span>News</span>', '/news/index', array('escape' => false)) ?>
					   <?php if (isset($user) && $user['User']['role'] != 1) { ?>
						<li><?=$html->link('<span>Add product</span>', '/products/add', array('escape' => false)) ?></li>
					   <?php } ?>
					</ul>
				</li>
				<li><?=$html->link('<span>About us</span>', '/products/aboutus', array('escape' => false)) ?></li>
				<li><?=$html->link('<span>Contact</span>', '/products/contact', array('escape' => false)) ?></li>
				<?php
				if ((isset($user) && $user) || (isset($facebook_user) && $facebook_user)) { ?>
					<li style="float:right">
						<?
							echo $html->link('<span>Logout</span>', '/users/logout', array('escape' => false));
						?>
					</li>
					<li style="float:right"><?php echo $html->link('<span>Profile</span>', '/users/view', array('escape' => false)) ?></li>
					<li class="<?php if ($this->name=='Users' && $this->action=='cart') echo 'active';?>" style="float:right"><?=$html->link('<span>Cart</span>', '/users/cart', array('escape' => false, 'id' => 'mycart')) ?></li>
				<?php } else { ?>
					<li style="float:right">
						<?php // echo $html->link('<span>Sign up</span>', '/users/register', array('escape' => false)) ?>
						<a href="#" id="register_a"><span>SIGN UP</span></a>
						<div  id="register_box" style="z-index:99999">
							<?php echo $this->Form->create('User', array('id' => 'UserHomepageForm')); ?>
								<h1 style="font-family: 'Open Sans', sans-serif; font-size:25; text-align:center">Registration</h1>
								<label id="label_signup">Email </label>
								<?
									echo $this->Form->input('username', array(
                                        'label'=>false,
                                        'div'=>false,
                                        'id'=>'textbox_signup',
                                        'required' => 'required',
                                        'placeholder' => 'Your email address',
                                        'pattern' => '^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$'));
								?>
								<label id="label_signup">Password </label>
								<?
									echo $this->Form->input('password', array(
                                        'type'=>'password',
                                        'label'=>false,
                                        'div'=>false,
                                        'id'=>'textbox_signup',
                                        'required' => 'required',
                                        'placeholder' => 'Password length: [6-20]',
                                        'pattern' => '.{6,20}'));
								?>
								<label id="label_signup">Repeat Password </label>
								<?
									echo $this->Form->input('password_confirm', array(
                                        'type'=>'password',
                                        'label'=>false,
                                        'div'=>false,
                                        'id'=>'textbox_signup',
                                        'required' => 'required',
                                        'placeholder' => 'Password length: [6-20]',
                                        'pattern' => '.{6,20}'));
								?>
								</br>
								<button type="submit" class="register_button" id="register_button">Register</button>
								<button class="register_button" id="register_box_close">Cancel</button>
							</form>
						</div>
					</li>
					<li style="float:right">
						<?php //echo $html->link('<span>Login</span>', '/users/login', array('escape' => false)) ?>
						<a href="#" id="login_a">Login</a>
						<div id="login_box" style="z-index: 1000">
							<?
								echo $this->Form->create('User', array('action' => 'login'));
							?>
							<div class="chat-bubble-arrow-border"></div>
							<div class="chat-bubble-arrow"></div>
                            <div>
    							<label style="line-height:30px">Email</label>
    							<?
    								echo $this->Form->input('username', array('label'=>false, 'div' => false, 'style' => 'float:right'));
    							?>
                            </div>
                            <div>
    							<label style="line-height:30px">Password</label>
    							<?
    								echo $this->Form->input('password', array('type'=>'password','label'=>false, 'div' => false, 'style' => 'float: right'));
    							?>
                            </div>
                            <span style="clear:both"></span>
							<button class="login_button" type="submit" value="Login" style="margin-left:83px">Log In</button>
                            <span class="login_button" id="login_close_button" style="padding:8px 14px">Close</span>
							</form>
						</div>
					</li>
					<li style="float:right">
						<?
							if(!isset($facebook_user) || !$facebook_user){
						?>
								<a href="<?php echo $loginUrl; ?>">
									<img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif">
								</a>
						<?
							}
						?>
					</li>
				<?php } ?>
			</ul>
		</div>
		<!-- Toolbar ends -->
	</div>
	<div id="jcarousel"></div>
	<div id="main">
		<?=$content_for_layout;?>
		<div id="fb-root"></div>
		<div id="coursera-footer">
			<div class="span9" style="padding-top: 8px; height: 32px; vertical-align: middle;">
				<a class="internal-home coursera-footer-link" href="/about">About</a>
				<a class="internal-home coursera-footer-link" href="/about/contact">Contact</a>
				<a class="internal-home coursera-footer-link" href="/about/press">Press</a>
				<a class="coursera-footer-link" href="http://help.coursera.org">Help</a>
			</div>

			<div class="span3">
				<a class="coursera-footer-social sp-googleplus" href="https://plus.google.com/111950594039269281469" target="tab3" title="Follow DealCruncher on Google Plus"></a>
				<a class="coursera-footer-social sp-twitter" href="http://twitter.com/coursera" target="tab1" title="Follow DealCruncher on Twitter"></a>
				<a class="coursera-footer-social sp-facebook" href="http://facebook.com/Coursera" target="tab2" title="Follow DealCruncher on Facebook"></a>
				<a class="coursera-footer-social sp-blog" href="http://blog.coursera.org"target="tab4" title="Read the DealCruncher blog"></a>
			</div>
		</div>
	</div>
</body>
</html>
